(function($) {
    $.fn.infoTip = function(options) {    
        var defaults = {
            paddingLeft: 0,
            paddingTop: 0
        }; 
        var opts = $.extend(defaults, options);
        $(this).each(function(){
            var _this = $(this);
            _this.hover(function(){
                $('<div id="detail-tip" class="detail-tip shadow-right" style="display:none;"><span class="arrow-left"></span></div>')
                    .appendTo('body')
                    .prepend(_this.find(".introHide").html());
                var offset = _this.offset();
                offset.left += opts.paddingLeft;
                if(offset.left + 320 > document.body.clientWidth){
                    offset.left = offset.left - 340 - opts.paddingLeft;
                    $("#detail-tip").addClass('shadow-left').removeClass('shadow-right')
                        .find('.arrow-left').addClass('arrow-right').removeClass('arrow-left');
                }
                $("#detail-tip").css({"left":offset.left, "top":offset.top,"display":"block"});
                //$("#detail-tip").css({"display":"block"});
            },function(){
                $("#detail-tip").remove();
            });
        });
    }
})(jQuery);

$(document).ready(function(){
    $('.item .pic').infoTip({paddingLeft:110});
});